package com.example.interesting.distributed.lock.realize.properties;

import com.example.interesting.distributed.lock.realize.strategy.DistributedLockExecutorStrategy;
import com.example.interesting.distributed.lock.realize.strategy.DistributedLockFailureStrategy;
import com.example.interesting.distributed.lock.realize.strategy.DistributedLockKeyBuilder;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author fyw
 * @version 1.0
 * @description: 分布式锁yaml配置信息
 * @date 2024/3/16 14:24
 */
@Getter
@Setter
@ConfigurationProperties(prefix = "distributed.lock")
public class DistributedLockProperties {


    /**
     * 分布式锁资源名称，即redis第一层级名，为空的话取“包名+类名+方法名”
     */
    private String prefixKey = "distributed:lock";


    /**
     * 分布式锁的过期时间，单位毫秒，默认30000毫秒
     */
    private long expire = 30000L;

    /**
     * 分布式锁获取超时时间，单位毫秒，默认30000毫秒
     */
    private long acquireTimeout = 30000L;


    /**
     * 分布式锁默认key生成策略
     */
    public Class<? extends DistributedLockKeyBuilder> primaryKeyBuilder;

    /**
     * 分布式锁获取失败处理策略
     */
    public Class<? extends DistributedLockFailureStrategy> primaryfailureStrategy;

    /**
     * 分布式锁执行器
     */
    public Class<? extends DistributedLockExecutorStrategy> primaryExecutorStrategy;
}
